import request from '@/utils/request'
import { SET_CHANNEL } from '@/store/actionType'

// 获取频道信息
export function getChannel () {
  return async dispatch => {
    // 发请求 获取频道信息.....
    const res = await request.get('channels')

    console.log('发请求 获取频道信息', res)

    // 保存到redux
    dispatch({
      type: SET_CHANNEL,
      payload: res.data.channels
    })
  }
}
